<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateFsLoginLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fs_login_logs', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('userId')->default(0)->comment('用户id');
            $table->string('feishuId', 32)->default('')->comment('飞书id');
            $table->string('appId', 32)->default('')->comment('应用id');
            $table->string('platform', 16)->default('')->comment('平台');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '飞书登录日志';

            $table->index('userId', 'idx_userId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('fs_login_logs');
    }
}
